1. Field of the Invention
The present invention relates generally to graphics systems, and more particularly to conversion of digital numbers to change resolutions for graphics systems.
2. Description of Related Art
A digital color image represented in a graphics system is composed of a large number of array of pixels. Each pixel in the array is associated with position and color information. The position information indicates the position of a pixel in the array, and the color information includes three basic colors (red, green and blue) so that the composite of the three basic colors attains a desired color for the pixel. The intensity of a basic color is represented by a digital number having a certain number of binary bits (or resolution).
Because resolutions may often differ at various points of graphical computation, conversion of visual attributes from one resolution to another is a common operation in graphics systems. Usually, color attributes in graphic systems are normalized within a range from 0.1 to 1.0. As an example, considering the intensity of the color red as a visual attribute, xe2x80x9cno rednessxe2x80x9d can be represented as 0.0 and the xe2x80x9chighest red intensityxe2x80x9d as 1.0. If a four-bit resolution is used at a certain point of graphical computation, the intensity value of red can be represented by a binary value ranging from 0.0000 to 0.1111.
Several methods exist for converting a digital number from one resolution to another. One such method is to add trailing zeros at the end of a digital number to obtain a higher resolution, and to truncate it to get a lower resolution. An exemplary conversion from a 4-bit resolution to a 10-bit resolution is illustrated in Table I as follows:
The basic approach described above would be acceptable if number range is always from xe2x80x9c0.0000 . . . xe2x80x9d to xe2x80x9c1.0000 . . . xe2x80x9d, where the dots after a digital number represent trailing significant bits. However, in many graphics systems, a binary value xe2x80x9c1.0000 . . . xe2x80x9d is actually represented as xe2x80x9c0.1111 . . . xe2x80x9d Consequently, simple additions of trailing zeros and truncations in resolution conversion may produce skewed results.
However, some of the skewed effects can be corrected by multiplying a conversion number (2{circumflex over ( )}N)/(2{circumflex over ( )}Nxe2x88x921) with the original value, where N is the number of bits in the original value. It should be noted that (2{circumflex over ( )}N)/ (2{circumflex over ( )}Nxe2x88x921) can be an indefinite repeating binary value. For example, when N is equal to 4, (2{circumflex over ( )}4)/( 2{circumflex over ( )}4xe2x88x921) is equal to a binary value of xe2x80x9c1.000100010001 . . . xe2x80x9d Therefore, an exemplary conversion from a 4-bit resolution to a 10-bit resolution with correction can be illustrated in Table II as follows:
However, the conversion with correction process shown above is not complete because the truncation to the extended value assumes that the extended value is always represented in a range from xe2x80x9c0.0000 . . . xe2x80x9d to xe2x80x9c1.0000 . . . xe2x80x9d. As previously discussed, many graphics systems represent a binary value xe2x80x9c1.0000 . . . xe2x80x9d as xe2x80x9c0.1111 . . . xe2x80x9d Therefore, the final value needs to be converted back to the range from xe2x80x9c0.0000 . . . xe2x80x9d to xe2x80x9c0.1111 . . . xe2x80x9d This conversion can be achieved by applying a range-conversion value (2{circumflex over ( )}Mxe2x88x921)/(2{circumflex over ( )}M), where M is the number of bits in the resulting resolution. Therefore, an exemplary conversion from a 4-bit resolution to a 10-bit resolution with correction and range-conversion can be illustrated in Table III as follows:
The conversion with correction and range-conversion process shown above requires two multiplies, one being (2{circumflex over ( )}N)/(2{circumflex over ( )}Nxe2x88x921) and the other being (2{circumflex over ( )}Mxe2x88x921)/(2{circumflex over ( )}M). Because either one of the two multiplies can be an indefinite binary number, the result of the two multiplications can also be an indefinite binary number. Since no digital system can be built to process indefinite numbers, the conversion with correction and range-conversion process described above is difficult to implement. This conversion process is further complicated when the first multiplication generates an indefinite binary value, which would then require the retention of enough bits to avoid carry propagation problems.
Therefore, there is a need for an improved apparatus and method to perform resolution conversion that requires less number of bits in implementing a digital system.
The present invention provides a novel method and apparatus for converting an input having an N-bit resolution to an output having an M-bit resolution. Upon receiving an original input having an N-bit input sequence, the method and apparatus generates an (N+M)-bit sequence by repeating the N-bit input sequence in the original input. A new M-bit sequence is generated by taking M Most Significant Bits from the (N+M)-bit sequence, and a new N-bit sequence is formed by taking N Most Least Significant Bits from the (N+M)-bit sequence. The M-bit resolution output is then formed by adjusting the new M-bit sequence based on the difference between the new N-bit sequence and the N-bit input sequence.
The apparatus of the present invention performs the resolution conversion process within a graphics engine of a computing device. The graphics engine includes a data module, a conversion module and a correction module. The data module receives the initial resolution data for an image and forwards the information to the conversion module, which subsequent converts the initial resolution data into a final resolution-bit sequence. The final resolution-bit sequence is then adjusted by the correction module to obtain final resolution data.